package cn.newgrand.netcall.integration;

import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;

import javax.swing.ImageIcon;

/**
 * @author SidneyRen E-mail:SidneyRen@hotmail.com
 * @version create time：2010-11-8 下午03:26:55
 * 类说明
 */
public class AppSysRes {
	public static Map<String,String> serverPrb = new HashMap<String, String>();
	private static PropertyResourceBundle prb;
	private static PropertyResourceBundle prb_i18n;
	public final static String INTEGRATION_IMAGE = "integration_image";
	public final static String INTEGRATION_EMAIL = "integration_email";
    public static final String TOASTER_VIEW_MORE = "TOASTER_VIEW_MORE";
    public static final String TOASTER_TITLE_TASK = "TOASTER_TITLE_TASK";
	
	
	public final static String APP_SERVER_URL = "integration.ng.app.server.url"; 

	//用于单点登入到应用系统的内/外网地址
	public static final String APP_SERVER_LOGIN_URL_INTRANET = "integration.ng.app.server.login.url.intranet";
	public static final String APP_SERVER_LOGIN_URL_INTERNET = "integration.ng.app.server.login.url.internet";
	
	public static final String APP_SERVER_AWAY_TIME = "integration.sms.away.time";
	public static final String APP_SERVER_OFFLINE_TIME = "integration.sms.offline.time";
	public static final String APP_SERVER_ISALLOW_CHANGE = "integration.sms.change.time.isallow";
	
	public final static String APP_DBSERVER = "integration.ng.app.dbserver"; 
	public final static String APP_DBSERVER_ACCOUNT = "integration.ng.app.dbserver.account"; 
	public final static String APP_USER_DEFAULT_OCODE = "integration.ng.app.user.default.ocode"; 
	public final static String APP_USER_MENU_FUNC = "integration.ng.app.menu.func"; //快捷功能菜单
	public final static String APP_SMS_ISAVAILABLE = "integration.ng.sms.isAvailable";
	
	public static final String APP_HID_MAINFORM = "integration.ng.app.hidmainform";
	public static final String APP_LANGUAGE = "integration.ng.app.language";
	public static final String APP_OTHER_PARAM = "integration.ng.app.otherparam";
	public static final String APP_FUNCTION_URL = "integration.ng.app.functionurl";
	public static final String APP_FUNCITON_URL_EMAIL =  "integration.ng.app.functionurl.email";
	
	

	
	
//	public static final String APP_SERVER_ADDRESS = "app_server_address";
//	public static final String DB_SERVER = "dbserver";
//	public static final String ACCOUNT = "account";
//	public static final String O_CODE = "ocode";
//	public static final String LOG_ID = "logid";
//	public static final String PWD = "pwd";
//	public static final String HID_MAINFORM = "hidmainform";
//	public static final String LANGUAGE = "language";
//	public static final String OTHER_PARAM = "otherparam";
//	public static final String FUNCTION_URL = "funtionurl";
	
//	public final static String MENU_SHOW_TRANSCRIPT = "menu_show_transcript";

    private AppSysRes() {
    	
    }

    static ClassLoader cl = AppSysRes.class.getClassLoader();

    static {
    	
        prb = (PropertyResourceBundle) ResourceBundle.getBundle("appSys");
        prb_i18n = (PropertyResourceBundle)ResourceBundle.getBundle("i18n/appSys_i18n_zh_CN");
        
    }

    public static final String getString(String propertyName) {
        return prb.getString(propertyName);
    }

    public static final ImageIcon getImageIcon(String imageName) {
        try {
            final String iconURI = AppSysRes.getString(imageName);
            final URL imageURL = AppSysRes.cl.getResource(iconURI);
            return new ImageIcon(imageURL);
        }
        catch (Exception ex) {
            System.out.println(imageName + " not found.");
        }
        return null;
    }
    
    public static final String getPropertyOnServer(String key){
    	return serverPrb.get(key);
    }

    public static final URL getURL(String propertyName) {
        return cl.getResource(AppSysRes.getString(propertyName));
    }

}
